<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>单元测试</title>
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
    <script src="../../assets/js/base.js"></script>
    <link rel="stylesheet" href="../../assets/css/exam.css">
</head>

<body>
    <main class="container flex-column">
        <header class="title">单元测试——{初中版本体验课-Unit 1}</header>
        <section class="exam-wrap flex-hei">
            <div class="exam">
                <header class="color_576f header">[英译汉]</header>
                <div class="exam-card">
                    <div class="label f_weight f30 color_576f">chat</div>
                    <div class="card-options-wrap">
                        <div class="exam-value">A 治疗</div>
                        <div class="exam-value exam-active">B 闲谈，聊天</div>
                        <div class="exam-value">C 确信的</div>
                        <div class="exam-value">D 有活力</div>
                    </div>
                </div>
                <div class="exam-card">
                    <div class="label f_weight f30 color_576f">chat</div>
                    <div class="card-options-wrap">
                        <div class="exam-value">A 治疗</div>
                        <div class="exam-value exam-success">B 闲谈，聊天</div>
                        <div class="exam-value">C 确信的</div>
                        <div class="exam-value">D 有活力</div>
                    </div>
                </div>
                <div class="exam-card">
                    <div class="label f_weight f30 color_576f">chat</div>
                    <div class="card-options-wrap">
                        <div class="exam-value exam-error">A 治疗</div>
                        <div class="exam-value">B 闲谈，聊天</div>
                        <div class="exam-value">C 确信的</div>
                        <div class="exam-value">D 有活力</div>
                    </div>
                </div>


                <header class="color_576f header">[听选]</header>
                <div class="exam-card">
                    <div class="label f_weight f30 color_576f iconfont lla-zu266"></div>
                    <div class="card-options-wrap">
                        <div class="exam-value">A 治疗</div>
                        <div class="exam-value">B 闲谈，聊天</div>
                        <div class="exam-value">C 确信的</div>
                        <div class="exam-value">D 有活力</div>
                    </div>
                </div>
                <div class="exam-card">
                    <div class="label f_weight f30 color_576f iconfont lla-zu266"></div>
                    <div class="card-options-wrap">
                        <div class="exam-value">A 治疗</div>
                        <div class="exam-value">B 闲谈，聊天</div>
                        <div class="exam-value">C 确信的</div>
                        <div class="exam-value">D 有活力</div>
                    </div>
                </div>


                <header class="color_576f header">[听写]</header>
                <div class="exam-card">
                    <div class="label f_weight f30 color_576f  iconfont lla-zu266"></div>
                    <div class="flex">
                        <div class="exam-hidden-btn">隐藏词义</div>
                        <div class="flex-wid exam-hidden f16">n.谈话</div>
                    </div>
                    <div class="write-wrapper">
                        <input type="text" placeholder="请输入正确单词">
                    </div>
                </div>
                <div class="exam-card">
                    <div class="label f_weight f30 color_576f  iconfont lla-zu266"></div>
                    <div class="flex">
                        <div class="exam-hidden-btn">隐藏词义</div>
                        <div class="flex-wid exam-hidden f16">n.谈话</div>
                    </div>
                    <div class="write-wrapper">
                        <input type="text" placeholder="请输入正确单词">
                    </div>
                </div>
            </div>
            <button class="exam-submit f16">交 卷</button>
        </section>
        <!-- 倒计时 -->
        <div class="count-down align-center">
            <span class="value hours">00</span>
            <span>:</span>
            <span class="value minute">00</span>
            <span>:</span>
            <span class="value seconds">00</span>
        </div>
    </main>

    <!-- 测试结果 -->
    <section class="mask exam-mask">
        <div class="exam-reslut flex-column">
            <header class="title f16 justify-center align-center">测试结果【共40道题，答对40道，答错0道]</header>
            <div class="flex-hei flex-column align-center justify-center">
                <div class="f30 f_weight">
                    <span>还不错！本次测试</span>
                    <span class="f50 color_576f">80</span>
                    <span>分</span>
                </div>
                <div class="f30 f_weight">继续努力吧！</div>
                <div class="align-center result-option">
                    <div class="circle iconfont llzhengque2"></div>
                    <div class="f30 f_weight color_71c4">Pass</div>
                </div>
                <div class="align-center result-option">
                    <div class="circle iconfont"></div>
                    <div class="f30 f_weight color_e8a8">Fail</div>
                </div>

                <div class="align-center result-footer">
                    <button class="result-btn result-error">查看错误</button>
                    <button class="result-btn exam-close">关闭窗口</button>
                </div>
            </div>
        </div>
    </section>


</body>
<script>
    $('.exam-value').on('click', function () {
        $('.exam-value').removeClass('exam-success').removeClass('exam-error')
        $(this).addClass('exam-active').siblings().removeClass('exam-active')
    })

    // 打开结束测试弹窗
    $('.exam-submit').on('click', function () {

        // 打开结束测试弹窗暂时注释
        // $('.exam-mask').show()
    })
    $('.exam-reslut, .exam-analyze').on('click', function () {
        return false
    })

    $('.exam-mask, .exam-close, .analyze-mask').on('click', function () {
        $('.exam-mask, .analyze-mask').hide()
    })

    /**
     *  @parma { Function } handleCountDown 倒计时
     *  @param { Number } allTime 倒计时间
     *  @param { Function } timer 定时器
     * */
    let allTime = 1 * 60 * 60 // 默认一个小时
    let timer = null
    function handleCountDown() {

        // 清除定时器
        if (allTime <= 0) {
            clearInterval(timer)
            return
        }

        allTime -= 1

        let hours = Math.floor(allTime / 60 / 60)
        let minute = Math.floor(allTime / 60)
        let seconds = allTime % 60 % 60

        $('.count-down .hours').text(hours > 9 ? hours : `0${hours}`)
        $('.count-down .minute').text(minute > 9 ? minute : `0${minute}`)
        $('.count-down .seconds').text(seconds > 9 ? seconds : `0${seconds}`)
    }
    timer = setInterval(handleCountDown, 1000)
</script>

</html>